package com.zby.simulationHibernate.util.common;

import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;

/**
 * Created By zby on 16:52 2019/1/23
 */

public class CommonUtil {

    /**
     * 判断不为空
     *
     * @param obj
     * @return
     */
    public static boolean isNotNull(Object obj) {
        if (obj instanceof String) {
            String str = (String) obj;
            return null != str && str.length() != 0;
        }
        if (obj instanceof Collection) {
            Collection collection = (Collection) obj;
            return null != collection && collection.size() != 0;
        }
        return null != obj;
    }


    /**
     * 判断为空
     *
     * @param obj
     * @return
     */
    public static boolean isNull(Object obj) {
        if (obj instanceof String) {
            String str = (String) obj;
            return null == str || str.length() == 0;
        }
        if (obj instanceof Collection) {
            Collection collection = (Collection) obj;
            return null == collection || collection.size() == 0;
        }
        return null == obj;
    }

}
